export{}
//unknown  是any的安全类型
// unknown 和any 进行任何操作，而不需要检查类型

let value:any
value = true
value = 1

let value2:unknown;
value2 = true
value2 = 12
value2 = []

value2 = 'hello'
//断言
console.log((value2 as string).length)
// typeof
if(typeof value2 == 'string'){
	console.log(value2.length)
}


//联合类型中的unknown 不管跟谁联合，最后都是unknown
type U1 = unknown | null
type U2 = unknown | undefined
type U3 = unknown | string
type U4 = unknown | number[]

//交叉类型
interface A{name:string}
interface B{age:number}
type C = A&B
let c:C = {name:'jin',age:10}

type AA = string | number
type BB = string | boolean
type CC = AA & BB;
let cc:CC = 'q23e4'

//never 是 unknown的子类型
type isNever = never extends unknown?true:false;
type keys = keyof unknown
let aa:unknown
let bb:unknown
console.log(aa === bb)
console.log(aa !== bb)
//aa+bb

//映射属性
type getType<T> ={
	[p in keyof T]:number
}
type t = getType<unknown>